#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2019/11/26 18:08|18:08
# @Author  : yangdingyi
# @File    : 翻转字符串里的单词
# @Software: PyCharm


class Solution:
    def reverseWords(self, s: str) -> str:
        arr = []
        for si in s.strip().split(' '):
            if si:
                arr.append(si)
        arr.reverse()
        return ' '.join(arr)


solve = Solution()

s = ' the sky  is blue'
print(s)
print(solve.reverseWords(s))
